<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    /**
    * Tables.
    **/
    define('PREFIX_CRUD', 'crud_');
     
    $config['tables']['tablas']                  = PREFIX_CRUD.'tablas';
    $config['tables']['campos']                  = PREFIX_CRUD.'campos';
    $config['tables']['tablas_grupos']           = PREFIX_CRUD.'tablas_grupos';
    $config['tables']['tipos_mantenimientos']    = PREFIX_CRUD.'tipos_mantenimientos';
    
    
    $config['crud_sql']['tablas']    = "CREATE TABLE IF NOT EXISTS `" . $config['tables']['tablas'] . "` (
                                              `id` int(11) NOT NULL AUTO_INCREMENT,
                                              `nombre` varchar(100) NOT NULL,
                                              `url_mantenimiento` varchar(200) DEFAULT NULL,
                                              `fk_id_".$config['tables']['tipos_mantenimientos']."` int(11) DEFAULT '0',
                                              `orden_menu_horizontal` int(5) DEFAULT 0,
                                              `orden_menu_vertical` int(5) DEFAULT 0,
                                              `fecmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                              PRIMARY KEY (`id`)
                                            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

    $config['crud_sql']['campos']    = "CREATE TABLE IF NOT EXISTS `" . $config['tables']['campos'] . "` (
                                              `id` int(11) NOT NULL AUTO_INCREMENT,
                                              `nombre` varchar(100) NOT NULL,
                                              `visible_vista` varchar(1) DEFAULT '0',
                                              `visible_form` varchar(1) DEFAULT '0',
                                              `es_descripcion` varchar(1) DEFAULT '0',
                                              `fk_id_" . $config['tables']['tablas'] . "` int(11) NOT NULL,
                                              PRIMARY KEY (`id`)
                                            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

    $config['crud_sql']['tablas_grupos']    = "CREATE TABLE IF NOT EXISTS `" . $config['tables']['tablas_grupos'] . "` (
                                                      `id` int(11) NOT NULL AUTO_INCREMENT,
                                                      `fk_id_groups` int(11) NOT NULL,
                                                      `fk_id_" . $config['tables']['tablas'] . "` int(11) NOT NULL,
                                                      PRIMARY KEY (`id`)
                                                    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

    $config['crud_sql']['tipos_mantenimientos']    = "CREATE TABLE IF NOT EXISTS `" . $config['tables']['tipos_mantenimientos'] . "` (
                                                          `id` int(11) NOT NULL AUTO_INCREMENT,
                                                          `nombres` varchar(50) NOT NULL,
                                                          `url` varchar(100) NOT NULL,
                                                          PRIMARY KEY (`id`)
                                                        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
    
    $config['crud_sql']['inserts1'] = "INSERT INTO `".$config['tables']['tipos_mantenimientos']."` (`id`, `nombres`) VALUES (1, 'crud');";
    $config['crud_sql']['inserts2'] = "INSERT INTO `".$config['tables']['tipos_mantenimientos']."` (`id`, `nombres`) VALUES (2, 'multinumero');";
    $config['crud_sql']['inserts3'] = "INSERT INTO `".$config['tables']['tipos_mantenimientos']."` (`id`, `nombres`) VALUES (3, 'imagen');";